/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package org.sbbs.demo.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.Index;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.Formula;
import org.sbbs.base.jpa.entity.BaseTreeEntity;
import org.sbbs.base.jpa.entity.BaseTreeEntity;

/**
 *
 * @author jenkins
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "demo_tree",
        indexes = {
            @Index(name = "idx_pid_fk", columnList = "pid")}
)
@Comment("树样例表")
public class DemoTree extends BaseTreeEntity {

    @Formula("(select count(1)>0 from demo_tree t where t.pid=id)")
    private boolean hasChildren;
    @Transient
    private boolean leaf = false;
}
